#ifndef ALGO_EVA_MODULE_BASE_H
#define ALGO_EVA_MODULE_BASE_H

#include "algohub_export.h"
#include "algohub_common_type.h"
#include "AlgoEvaluatorDB.h"
#include <memory>

namespace algo
{
	class AlgoEvaluatorModuleBasePrivate;
	class ALGOHUB_EXPORT AlgoEvaluatorModuleBase
	{
	public:
		AlgoEvaluatorModuleBase();
		virtual ~AlgoEvaluatorModuleBase();

		virtual std::vector<algobase::EvaluateEnvirDataType> getNeedType() = 0;
		virtual int exec(const algobase::Path& path, double& result, algobase::EvaluateModuleCoords& indexCoords);
		virtual double calcScore(double rawValue) const = 0;
		virtual double calcRaw(const std::vector<double>& rawValues) const = 0;

	public:
		void setDB(std::shared_ptr<algo::AlgoEvaluatorDB> db);
		void setTaskConfig(const algobase::TaskConfig& taskConfig);
		void setWeight(double weight);

		std::shared_ptr<algo::AlgoEvaluatorDB> getDB() const;
		algobase::TaskConfig getTaskConfig() const;
		double getWeight() const;

		std::string getLastErrorMessage() const;

	protected:
		void setErrorMessage(const std::string & = "");
		double benefitSigmoid(double x, double x0, double s) const;
		double costSigmoid(double x, double x0, double s) const;

	private:
		AlgoEvaluatorModuleBasePrivate* d;
	};
}

#endif // !ALGO_EVA_MODULE_BASE_H
